package mobile.pubcrawler;

import android.content.Context;
import android.location.Address;
import android.text.Html;
import android.util.AttributeSet;
import android.widget.TextView;

public class FooterView extends TextView {

	public FooterView(Context context) {
		super(context);
		update();
	}
	
	public FooterView(Context context, AttributeSet set) {
		super(context, set);
		update();
	}
	
	public FooterView(Context context, AttributeSet set, int defaultStyle) {
		super(context, set, defaultStyle);
		update();
	}
	
	public void update() {
		Address address = Filter.getInstance().getRelativeToAddress();
		if (address==null) {
			address = GPSManager.getInstance().getAddress(true, 0, 0);
		}
		if (address!=null) {
    		String str = address.getAddressLine(0);
    		if (address.getMaxAddressLineIndex()>0)  str += ", "+address.getAddressLine(1);
    		this.setText(Html.fromHtml(str));	
    	}
	}
	
}
